package kr.hkit.androidcomplete01.chaptert07;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.View;

public class PrimitiveEx2 extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MyView mv = new MyView(this);
		setContentView(mv);
	}
	
	class MyView extends View {

		public MyView(Context context) {
			super(context);
		}
		
		public void onDraw(Canvas canvas){
			Paint Pnt = new Paint();
			Pnt.setColor(Color.LTGRAY);
			canvas.drawPaint(Pnt);
			
			//빨강색 둥근 사각형
			RectF r = new RectF();
			Pnt.setColor(Color.RED);
			canvas.drawRoundRect(r, 10, 10, Pnt);
			
			//타원
			r.set(110, 10, 150, 100);
			canvas.drawOval(r, Pnt);
			
			//분홍색 반달
			Pnt.setColor(Color.MAGENTA);
			r.set(10, 110, 100, 200);
			canvas.drawArc(r, 10, 150, false, Pnt);
			
			//분홍색 파이
			r.set(110, 110, 200,200);
			canvas.drawArc(r, 10, 150, true, Pnt);
			
			//파란색 다각선
			Pnt.setColor(Color.BLUE);
			float[] pts = {10, 210, 50, 250, 50, 250, 110, 220};
			canvas.drawLines(pts, Pnt);
			
			//검은색 점 3개
			Pnt.setColor(Color.BLACK);
			float[] pts2 = {20, 210, 50, 240, 100, 220 };
			canvas.drawPoints(pts2, Pnt);
			
			
			
			
		
			
		}
	}
}
